home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload Trio 2 / Shareware Overload Trio Volume 2 (Chestnut CD-ROM).ISO / dir26 / epi601_2.zip / FILES06.EXE / ENTTYPES.INC < prev    next >
Text File  |  1994-08-22  |  13KB  |  278 lines

  1. const
  2.   TNNearlyZero = 1E-015;
  3.   Infinity     = 1E+50;
  4.   RealSize     = 8;
  5.   MaxToken    = 25;
  6.   MaxVars     = 20;
  7.  
  8. type
  9.     Float = Double; { 8 byte real, requires 8087 math chip }
  10.     String80    = String [80];
  11.     Alfa        = Packed Array [1 .. 10] of Char;
  12.     String20    = String [20];
  13.     StringPtr   = ^ String;
  14.     LongStrPtr  = ^ String;
  15.     PtrListPtr  = ^ ListPtr;
  16.     ListPtr     = record {for a simple linked list of pointers}
  17.                     next : PtrListPtr;
  18.                     ptr : pointer;
  19.                   end;
  20.     TokenString = String [MaxToken];
  21.     FilePtr     = ^ ByteFile;
  22.     ByteFile    = File of Byte;
  23.     ValueRecord = Packed Record
  24.                     Case Integer of
  25.                       0: (IntVal  : Integer);
  26.                       1: (RealVal : Float);
  27.                       2: (StrVal  : String20)
  28.                   End {ValueRecord};
  29.     LegalPtr    = ^ LegalRecord;
  30.     LegalRecord = Packed Record
  31.                     Value      : ValueRecord;
  32.                     NewValue   : ValueRecord;
  33.                     IsNew      : Boolean;
  34.                     Next       : LegalPtr
  35.                   End {LegalRecord};
  36.     EntryType   = (Numeric, Alpha,    Date, Uppercase, CheckBox, YesNo,
  37.                    RealNum, PhoneNum, Time, LocalNum,  TodayType,EuroDate,
  38.                    IDNum,   Res4,     Res5);
  39.     FileRecPtr      = ^ FileRecord;
  40.     CommandPtr  = ^ CommandRec;
  41.     VarPtr      = ^ VariableRec;
  42.     { VariableRec is a node in a tree-structure.  It contains a variable
  43.        type and, depending on that variable type, either a number or a
  44.        string. }
  45.     VarTypes    = (VReal, VString, VDate, VEuroDate);
  46.     VariableRec = Packed Record
  47.                     Name        : String20;
  48.                     Left        : VarPtr;
  49.                     Right       : VarPtr;
  50.                     Global      : Boolean;
  51.                     Cumulative  : Boolean;
  52.                     Missing     : Boolean;
  53.                     Width       : Byte;
  54.                     Decimals    : Byte;
  55.                     Case VarType : VarTypes of
  56.                       VReal   : (VFloat  : Float);
  57.                       VDate,
  58.                       VEuroDate,
  59.                       VString : (VAlfa   : String80)
  60.                   End {VariableRec};
  61.     FieldPtr    = ^ FieldList;
  62.     FieldRecord = Record
  63.                     EntryKind  : EntryType;
  64.                     EntryLen   : Byte { 0 means no entry for this field };
  65.                     Name       : Alfa;
  66.                     MustEnter  : Boolean;
  67.                     Repeated   : Boolean;
  68.                     QuestionX  : Byte;
  69.                     QuestionY  : Integer;
  70.                     QuestionC  : Byte;
  71.                     EntryX     : Byte;
  72.                     EntryY     : Integer;
  73.                     EntryColor : Byte;
  74.                     FieldChar  : Char;
  75.                     Hidden     : Boolean;
  76.                     Decimals   : Byte;
  77.                     HasMin     : Boolean;
  78.                     FieldMin   : ValueRecord;
  79.                     HasMax     : Boolean;
  80.                     FieldMax   : ValueRecord;
  81.                     CommentLen : word;
  82.                     MissingLegal : LegalPtr;
  83.                     Jumps      : LegalPtr;
  84.                     CodeField  : FieldPtr;
  85.                     AutoJump   : FieldPtr;
  86.                     BeforeCmds : CommandPtr;
  87.                     AfterCmds  : CommandPtr;
  88.                     NoEnter    : Boolean;
  89.                     CurColor   : Byte;
  90.                     KeyNum     : Byte;
  91.                     Unique     : Boolean;
  92.                     Question   : String80;
  93.                     HasSoundex : boolean;
  94.                     HelpCommand : CommandPtr;
  95.                     LegalsInFile : Boolean;
  96.                     CodesInFile : Boolean;
  97.                     case integer of
  98.                       0 : (Legal      : LegalPtr;
  99.                            Codes      : LegalPtr);
  100.                       1 : (LegalFileRecPtr : FileRecPtr;
  101.                            CodesFileRecPtr : FileRecPtr);
  102.                   End;
  103.     FieldList   = Record
  104.                     Previous     : FieldPtr;
  105.                     Next         : FieldPtr;
  106.                     Missing      : Boolean;
  107.                     FieldInt     : Integer;
  108.                     FieldReal    : Float;
  109.                     FieldEntry   : String80;
  110.                     Field        : FieldRecord;
  111.                     firstEntry   : String80;
  112.                   End;
  113.    { PtrRec is used to point to variables.  Since there are two
  114.        kinds of variables used in the program, IsField determines
  115.        what type of variable the one pointed to is }
  116.     PtrRec      = Packed Record
  117.                     DoAll : Integer;
  118.                     Case IsField : Boolean of
  119.                       True: (FP : FieldPtr);
  120.                       False: (VP : VarPtr)
  121.                   End {PtrRec};
  122.     StackRecPtr = ^ StackRec;
  123.     StackPtr    = ^ StackType;
  124.     { StackRecord is the basic stack data structure.  It consists
  125.        of a type identifier (ExpType) followed by four variant parts.
  126.        If the type is VarExp, then VarHole is an index into the VarArray
  127.        in the StackType, which contains a pointer to the proper variable.
  128.        This allows the stack to be built once, and the variable's value
  129.        put into the proper position in the stack automatically, without
  130.        having to rebuilt. }
  131.     ExpKind     = (NumExp, OpExp, VarExp, StrExp, StrDateExp, StrEuroExp,
  132.                    DateExp, MissExp);
  133.     OpType      = (AddOp,     SubOp,      MulOp,   DivOp,   ExptOp,
  134.                    RParen,    LParen,     LessOp,  GreatOp, LessEqOp,
  135.                    GreatEqOp, NotEqualOp, EqualOp, AndOp,   OrOp,
  136.                    IntDivOp,  NotOp,      RndOp,   LogOp,   LnOp,
  137.                    RandomOp,  ExpOp,      StripOp, EndOp,   DummyOp);
  138.     StackRecord = Packed Record
  139.                     Case ExpType : ExpKind of
  140.                       NumExp, DateExp :
  141.                         (Num : Float);
  142.                       OpExp:
  143.                         (Op  : OpType);
  144.                       VarExp :
  145.                         (VarHole : Integer;
  146.                          SubPos  : Byte;
  147.                          SubLen  : Byte);
  148.                       StrExp, StrDateExp, StrEuroExp:
  149.                         (MatchPos : Integer;
  150.                          StackIdx : Byte   { Index into string stack };
  151.                          St       : TokenString)
  152.                   End {StackRecord};
  153.     StackRec    = Packed Record
  154.                     Next    : StackRecPtr;
  155.                     Rec     : StackRecord
  156.                   End {StackRec};
  157.     { Stacktype contains the standard stack data structures, as well as an
  158.        array of pointers to variables.  This allows the program to build
  159.        the stack once, and stick the variables in the correct holes every
  160.        time the stack needs evaluating, rather than rebuilding the stack
  161.        every time it's needed }
  162.     StackType   = Packed Record
  163.                     Top      : Integer;
  164.                     VarArray : Packed Array [1 .. MaxVars] of PtrRec;
  165.                     S        : StackRecPtr;
  166.                     PopPtr   : StackRecPtr
  167.                   End {StackType};
  168.     Commands    = (CmdIF,     CmdLET,    CmdJUMP,  CmdTYPE,   CmdHELP,
  169.                    CmdCLEAR,  CmdCOLOR,  CmdLOAD,  CmdUNLOAD, CmdVALIDATE,
  170.                    CmdUPDATE, CmdAUTOSEARCH, CmdKEY, CmdEXIT, CmdINCLUDE,
  171.                    CmdTYPECOMMENT, CmdHIDE, CmdUNHIDE, CmdFIELDCHAR,
  172.                    CmdDEFINE, CmdRELATE, CmdENTER, CmdCOMMENT);
  173.     CommandRec  = Record
  174.                     NextCommand     : CommandPtr;
  175.                     Case Command    : Commands of
  176.                       CmdIF:
  177.                         (IfExpression : StackPtr;
  178.                          IfCmds       : CommandPtr;
  179.                          ElseCmds     : CommandPtr);
  180.                       CmdLET:
  181.                         (Variable     : PtrRec;
  182.                          LetExp       : StackPtr);
  183.                       CmdJUMP:
  184.                         (JumpEOR      : Boolean;
  185.                          JumpVar      : FieldPtr);
  186.                       CmdCLEAR:
  187.                         (ClearAll     : Boolean;
  188.                          ClearVar     : FieldPtr);
  189.                       CmdHIDE,
  190.                       CmdUNHIDE,
  191.                       CmdFIELDCHAR :
  192.                         (SetAll       : Boolean;
  193.                          SetVar       : FieldPtr;
  194.                          SetData      : Integer);
  195.                       CmdTYPE,CmdTYPECOMMENT:
  196.                         (TypeFile     : Boolean;
  197.                          TypeString   : LongStrPtr;
  198.                          XRelative    : Boolean;
  199.                          X            : ShortInt;
  200.                          YRelative    : Boolean;
  201.                          Y            : ShortInt;
  202.                          TypeColor    : Integer);
  203.                       CmdHELP:
  204.                         (HelpFile     : Boolean;
  205.                          HelpString   : LongStrPtr;
  206.                          HelpXRel     : Boolean;
  207.                          HelpX        : ShortInt;
  208.                          HelpYRel     : Boolean;
  209.                          HelpY        : ShortInt;
  210.                          HelpTopic    : Word;
  211.                          HelpKeys     : LongStrPtr);
  212.                       CmdCOLOR:
  213.                         (DSetType     : Integer;
  214.                          DataColor    : Integer;
  215.                          QSetType     : Integer;
  216.                          QuesColor    : Integer;
  217.                          ColorField   : FieldPtr);
  218.                       CmdLOAD, CmdUNLOAD:
  219.                         (LoadModule   : LongStrPtr;
  220.                          Default      : Boolean);
  221.                       CmdVALIDATE:
  222.                         (CallModule   : String [8];
  223.                          CallParam    : Integer);
  224.                       CmdUPDATE:
  225.                         (UpdateParam  : (UpdateOn, UpdateScr, UpdateOff));
  226.                       CmdENTER,
  227.                       CmdRELATE:
  228.                         (RelatedFile  : Word;
  229.                          RelatedField : FieldPtr { Points to master field };
  230.                          RelatedName  : Alfa;
  231.                          RepeatCount  : Integer);
  232.                      CmdCOMMENT:
  233.                        (CommentText   : LongStrPtr);
  234.                       CmdAUTOSEARCH :
  235.                         (UseSoundex   : boolean;
  236.                          ListAll      : boolean;
  237.                          ASFields     : PtrListPtr);
  238.                   End {CommandRec};
  239.     FileStatusType  = (FilePurged,  FileRead,  FileNotFound);
  240.     FileBlockStatus = (FileRelated, FileNoKey, FileUnrelated);
  241.     MapTypeS        = (OneToOne, OneToMany);
  242.     RelationPtr     = ^ RelationRecord;
  243.     RelationRecord  = Record
  244.                         FatherField    : FieldPtr;
  245.                         SonField       : Alfa;
  246.                         SonFile        : Byte;
  247.                         MapType        : MapTypeS;
  248.                         Condition      : StackPtr  { NIL = Unconditional };
  249.                         Next           : RelationPtr
  250.                       End {RelationRecord};
  251.     FileRecord      = Record
  252.                         FileName       : StringPtr       {'' =File rec empty};
  253.                         RecSize        : Integer         { 0 =Uninitialized };
  254.                         DataOffset     : Word            { 0 =Uninitialized };
  255.                         RecordNum      : LongInt         {-1 =EOF };
  256.                         IsDeleted      : Boolean         {False};
  257.                         LocalVarHeader : VarPtr;
  258.                         QHeader        : FieldPtr        {NIL =Purged };
  259.                         InitCommands   : CommandPtr      {NIL=None}; {called once for file}
  260.                         DoneCommands   : CommandPtr      {NIL=None}; {called once for file}
  261.                         PreCommands    : CommandPtr      {NIL=None}; {called once per record}
  262.                         PostCommands   : CommandPtr      {NIL=None}; {called once per record}
  263.                         DataStatus     : FileStatusType  {FilePurged};
  264.                         ChkStatus      : FileStatusType  {FilePurged};
  265.              { * Context saving information for switching files * }
  266.                         CurQuestion    : FieldPtr        {NIL};
  267.                         CurLine        : Integer         {0};
  268.                         TopLine        : Integer         {0};
  269.                         BottomLine     : Integer         {0};
  270.                         DataChanged    : Boolean         {False};
  271.                         F              : ByteFile;
  272.                         IndexStatus    : FileStatusType  {FilePurged};
  273.                         Relations      : RelationPtr     {NIL =No relations};
  274.                         FileStatus     : FileBlockStatus {FileRelated};
  275.                         NKeys          : Byte            {0};
  276.                         MustSave       : Boolean; { KAB 09/16/91 }
  277.                         IsVerified     : Boolean;
  278.                       End { FileRecord};